package com.xcity.game.combat.skill.impl;

import com.xcity.game.combat.Action;
import com.xcity.game.combat.ActionEffect;
import com.xcity.game.combat.CombatUtils;
import com.xcity.game.combat.skill.CombatSkill;
import com.xcity.game.combat.unit.CombatUnit;
import com.xcity.game.common.GameStaticConfig;
import com.xcity.game.skill.Skill;

/**
 * 雪上加霜<br/>
 * 一次单体攻击，造成{0}%技能伤害，若目标处于出血状态则额外造成{1}%技能伤害。
 * @author yang.li
 *
 */
public class COMBAT_SKILL_90124 extends CombatSkill {

	public COMBAT_SKILL_90124(Skill skill) {
		super(skill);
	}

	@Override
	public void calcDamage(Action action) {
		CombatUnit source = action.unit;
		CombatUnit target = action.target.getDefenseUnit(source.getIndex());
		if (target != null) {
			ActionEffect eff = action.addTarget(target);
			target = eff.getUnit();
			float rate = skill.getParameter(0) / GameStaticConfig.percentBase;
			if (target.getBuff(9) != null) {
				rate += skill.getParameter(1) / GameStaticConfig.percentBase;
			}
			CombatUtils.calcMagicAttack(eff, rate);
		}
	}

}
